I'm mainly looking for confirmation my plan is
going to work as intended, so any input to this will be
welcome.
I've had my lathe running Mach3 for a couple years,
and in that time I've realised the limitations of the
existing setup. If my turret fails to lock, then I have
to open KMotion and toggle the output to trigger another
attempt at locking. The same goes for if for some reason
it locks at the wrong position (Every so often it spins
the wrong direction, meaning it locks in the wrong
position - all that is handled by a PLC, and I've never
been able to figure out why, but at most it happens once
every couple of hundred changes, and the PLC flags it up
as a problem and motion stops so is pretty low on the
list of priorities).
As part of my move from Mach3, I'm cleaning up and
re-writing code as I go.
My current init flow is something along the lines
of-
1) Initialise axis servos. Disable and trigger
reset line if needed. If one attempt fails, display
message box and ask if another attempt should be made.
If not, sit in an infinite loop to stop anything
happening. Init has to be run again if needed.
At this point jogging/homing can be allowed, but no
code ran.
2) Check status of TC. Make sure position details
are being transferred via Modbus, and we have a TCOK
signal from the PLC (hardwired to a Kanalog input). If
any problems, display a message box, warning the TC has
a problem, and advising to move the turret clear of the
spindle, and use the Recover TC user button (just a
small program to toggle the output allowing a change to
happen, but only functions when in initialisation mode
(I've got a virtual bit that gets set until everything
has initialised ok).
Once the TC is showing good, the lathe can be run
as normal.
One area I'm not sure about, is preventing code
from being run before the machine is fully initialised.
Obviously KMotionCNC doesn't have the same e-stop
functionality as Mach, so I'm needing a bit
clarification on how to stop things from working.
If I create a user programme that gets run when
Cycle Start is pressed, which checks that everything is
initialised ok (essentially checks axis are enabled,
machine is homed, and TC is good), can I then use that
program to issue a Halt motion command if there is a
problem?
Or is there a better way to prevent code from
running?
The next area is homing. Mach had LEDs showing the
homed status of each axis, but I'm guessing I'll need to
add checks into the KFlop to ensure homing has been
completed prior to any code being executed?
One thing I've noticed when going over my Mach3
init.c file, is I obviously changed the MaxError values
instead of the MaxFollowingError values for the axis (it
may explain why certain crashes didn't trigger an
e-stop!). They're currently 40 for the X and 50 for the
Z. Will changing these back to the default of 200 have
any undesired consequences, given I don't remember
changing that setting when tuning the servos?
Thanks,
Moray